1. /* scmfput.cpp by K.Tsuru */
  2. // function ID = 900
  3. /**************************
  4. SComplex class
  5. It provides the output.
  6. **************************/
  7. #ifndef SN_H
  8. #include "sn.h"
  9. #endif
  10. long SComplex::Put(int fmt) const { // change since ver.2.21
  11. scLineFormat = fmt; ioCount = 0;
  12. SDouble abs_im;
  13. long p = 0;
  14. if(scLineFormat & BracketFMT){
  15. re.FPutc('('); p++;
  16. p += re.Put();
  17. re.FPuts(", "); p += 2;
  18. if(scLineFormat & MID_CR) { re.FPutc('\n'); p++; }
  19. p += im.Put();
  20. re.FPutc(')'); p++;
  21. if(scLineFormat & END_CR){ re.FPutc('\n'); p++; }
  22. return ioCount = p;
  23. }
  24. int imSign = im.Sign(900);
  25. if(imSign < 0) abs_im = Dabs(im);
  26. if(scLineFormat & MID_CR) p = re.Puts();
  27. else p = re.Put();
  28. if(imSign < 0){
  29. p += re.FPuts("-i*");
  30. p += abs_im.Put();
  31. } else if(imSign > 0){
  32. p += re.FPuts("+i*");
  33. p += im.Put();
  34. } else p += re.FPuts("+i*0.0");
  35. if(scLineFormat & END_CR){
  36. re.FPutc('\n'); p++;
  37. }
  38. return ioCount = p;
  39. }

scmput.cpp : last modifiled at 2017/06/16 11:51:26(983 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).